#include <iostream>
#include <cstring>
using namespace std;
#define DEBUG
inline int read()
{
    int c=getchar(), f=1, x=0;
    if(c=='-') f*=-1, c=getchar();
    while(c<'0'&&'9'<c) c=getchar();
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    return f*x;
}

inline void write(int x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) write(x/10);
    putchar(x%10+'0');
}
const int N=1010, M=11, INF=0x3f3f3f3f;
int n, m;
int store[N][M];

void init()
{
    n=read(), m=read();
    for(int i=1; i<=n; i++)
        for(int j=1; j<=m; j++)
            store[i][j]=read();
    
}

inline void print()
{
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
            printf("%d ", store[i][j]);
        puts("");
    }
        
}

void solve()
{
    init();
    // print();
    for(int i=1; i<=n; i++)
    {
        int flag=true; //有上级
        for(int j=1; j<=n; j++)
        {
            int sum=0;
            for(int k=1; k<=m; k++)
                sum+=(store[j][k]>store[i][k]); //找到所有小于的
            if(sum==m) //j的每一维都大于i
            {
                printf("%d\n", j);
                flag=0;
                break; //找到答案了
            }
        }
        if(flag) printf("0\n");
    }
    
}

signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif

    int T=1; //cin >> T; 
    while(T--) 
    {
        solve();
    }
    return 0;
}